<?php

namespace app\admin\model\sales;

use think\Model;

/**
 * Debtorsmaster
 */
class Debtorsmaster extends Model
{
    // 表主键
    protected $pk = 'debtorno';
    
    // 表名
    protected $name = 'sales_debtorsmaster';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;


    public function currcodeTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\fm\Currencies::class, 'currcode', 'currabrev');
    }

    public function salestypeTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Salestypes::class, 'salestype', 'typeabbrev');
    }

    public function holdreasonTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Holdreasons::class, 'holdreason', 'reasoncode');
    }

    public function paymenttermsTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Paymentterms::class, 'paymentterms', 'termsindicator');
    }

    public function typeidTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Debtortype::class, 'typeid', 'typeid');
    }
}